import java.util.*;

public class ShippingInfo {

   private static final String[] states = {
      "AK", "AZ", "CA", "DE", "NV", "NY"};

   public static Iterator getStates() {
      return new StateIterator();
   }
   public static void main(String[] args) {
      Iterator iter = getStates();
      while (iter.hasNext()) {
         System.out.println(iter.next());
      }
   }

   public static class StateIterator implements Iterator {
      private int current = 0;
      /* from Iterator */
      public boolean hasNext() {
         return current < states.length;
      }
      /* from Iterator */
      public Object next() {
         return nextState();
      }
      /* from Iterator */         
      public void remove() {
         throw new UnsupportedOperationException();
      }
      /* custom typesafe next */         
      public String nextState() {
         if (current < states.length) {
            String state = states[current];
            current++;
            return state;
         } else {
            throw new NoSuchElementException();
         }
      }

   }
}
